﻿using EventBus.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;

namespace CollegeTecManageSystem.EntityFrameworkCore
{

    [DependsOn(
        
         typeof(AbpEntityFrameworkCoreMySQLModule),
         typeof(AbpMultiTenancyModule)
        )]
    public class EventBusEntityFrameworkCoreModule : AbpModule
    {

        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            //context.Services.AddTransient<IConnectionStringResolver, MyMultiTenantConnectionStringResolver>();
            context.Services.AddAbpDbContext<EventBusDbContext>(options =>
            {
                /* Remove "includeAllEntities: true" to create
                 * default repositories only for aggregate roots */
                options.AddDefaultRepositories(includeAllEntities: true);
            });
  

            Configure<AbpDbContextOptions>(options =>
            {
                /* The main point to change your DBMS.
                 * See also CollegeTecManageSystemMigrationsDbContextFactory for EF Core tooling. */
                options.UseMySQL();
            });
        }
    }
}
